/**
 * @file Menu.c
 * @author Jasper
 * @brief
 * @version 0.1
 * @date 2024-12-10
 *
 * @copyright Copyright (c) 2024
 *
 */
#include "Menu\Menu.h"
#include "Alarm_Clock\Alarm_Clock.h"
int MODI_ALARM[NUM_OF_MODIFY] = {
    3,  // MODI_Month_2 =
    6,  // MODI_Day_2 =
    9,  // MODI_Hour_2 =
    11, // MODI_Min_1 =
    12, // MODI_Min_2 =
    16  // MODI_Setting =
};
const char *Menu_Char[] = {"TIME",
                           "LIGHT",
                           "MUSIC",
                           "WHETH",
                           "ALARM",
                           "SETTI",
                           "ABOUT"};
int mode = 2;                      // 菜单项索引
int OLED_Page = 0;                 // 0是时间，1是菜单
int Song_Choose = 0;               // 歌曲选择索引
int TMP_Play_Song = 0;             // 歌曲播放索引
int TMP_ACLOCK = 0;                // 闹钟索引
Struct_Alarm_Clock MENU_TMP_ALARM; // 闹钟暂存值
int TMP_MODI_ACLOCK = MODI_Month;  // 闹钟修改索引
int Menu_X[Num_Of_Menu] = {0};     // 菜单打印横坐标索引
int Modi_Alarm_First_time = 1;     // 闹钟修改初始化
int Modi_Dispaly_base;             // 闹钟修改项索引
int MAIN_MENU_Limit(int Tmp_Menu)
{
    if (Tmp_Menu > 3)
        return Tmp_Menu - Num_Of_Menu;
    else if (Tmp_Menu < -3)
        return Tmp_Menu + Num_Of_Menu;
    else
        return Tmp_Menu;
}
int Alarm_Print_Limit(int Tmp_Menu)
{
    if (Tmp_Menu > 4)
        return Tmp_Menu - NUM_OF_ALARM;
    else if (Tmp_Menu < -3)
        return Tmp_Menu + NUM_OF_ALARM;
    else
        return Tmp_Menu;
}
void Return_Time_Page(void)
{
    OLED_Page = Time_Page;
    return;
}
void Return_Manu_Page(void)
{
    OLED_Page = Menu_Page;
    return;
}
int limited(int Tmp_Num, int Tmp_Min, int Tmp_Max)
{
    if (Tmp_Num > Tmp_Max)
        return Tmp_Max;
    else if (Tmp_Num < Tmp_Min)
        return Tmp_Min;
    else
        return Tmp_Num;
}
//
